/* @(#)GSManufactureAddAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-3-1
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import org.apache.commons.beanutils.BeanUtils;

import com.hitrust.gs.bean.GSManufactureBean;
import com.hitrust.gs.form.GSManufactureModifyForm;

import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.util.exception.GSException;
import com.hitrust.gs.business.GSManufactureProcessor;

/**
 * 修改产品信息
 */
public class GSManufactureModifyAction extends GSBaseAction {

    /*
     * (non-Javadoc)
     * 
     * @see com.hitrust.gs.service.GSBaseAction#execute(com.hitrust.gs.service.GSBaseForm)
     */
    public String execute(GSBaseForm aForm) throws Exception {
        GSManufactureModifyForm tForm = (GSManufactureModifyForm) aForm;
        GSManufactureProcessor tGSManufProcessor = new GSManufactureProcessor();
        
        try {
            GSManufactureBean tGSManufactureBean = new GSManufactureBean();
            BeanUtils.copyProperties(tGSManufactureBean, tForm);
            // String tManuftype1 = tForm.getManuftype1();
            // String tManuftype2 = tForm.getManuftype2();
            // String tManuftype3 = tForm.getManuftype3();
            // 添加产品种类
            // if (tManuftype2.equals("0")) {
            // tGSManufactureBean.setGs_manufacture_category_id(tManuftype1);
            // } else if (tManuftype3.equals("0")) {
            // tGSManufactureBean.setGs_manufacture_category_id(tManuftype2);
            // } else {
            // tGSManufactureBean.setGs_manufacture_category_id(tManuftype3);
            // }

            // 修改产品信息

            GSManufactureProcessor.modifyManufactureTask(tGSManufactureBean);
            
            String product_type = tForm.getProduct_type();
            // 写入过滤表
            tGSManufProcessor.freshFilterByManufactorID(tForm.getGs_manufacture_id());
            aForm.getRequest().setAttribute("message", "修改产品执行成功");
            aForm.getRequest().setAttribute("backstep", "0");
        } catch (Exception e) {
            aForm.getRequest().setAttribute("message", "修改产品执行失败");
            aForm.getRequest().setAttribute("window", "true");
            GSLogWriter.error(this, e.toString());
            // throw new GSException(GSException.E10044,GSException.E10044_MSG);
        }
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}